package com.myx.juc.threadpool;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

/**
 * 描述: 定时线程池
 * @author: myx
 * @date: 2018/11/23
 * Copyright © 2018-hotpot. All rights reserved.
 */
public class SchedulePoolDemo {
    public static void main(String[] args) {
        ScheduledExecutorService scheduledExecutorService= Executors.newScheduledThreadPool(10);
        scheduledExecutorService.schedule(()->{
            System.out.println("5");
        },5, TimeUnit.SECONDS);
        scheduledExecutorService.shutdown();
    }
}
